Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next

agent

The view selection formula may be a bit tricky tbh, not sure I can think of an easy one.

Depending on number of documents you could just loop through all in the agent and check the values on the field (which would be easier to work out how to do but maybe not as fast)

So you'd just look through all documents in the db, then each item in the field comparing against dates and setting a field to Y if the relevant date range was found (and ensuring the field was blank if not in the range any more).

Quick and dirty code would be (on a scheduled agent run against all documents in the database). This isn't tested in the slightest!

dim s as new notessession
dim db as notesdatabase
set db = s.currentdatabase
dim doccol as notesdocumentcollection
set doccol = db.unprocesseddocuments

'get the start and end date range as notesdatetimes
'there may be a better way of doing this, I always end up writing more code than I think should be necessary for date comparisons
dim sdate as notesdatetime
dim edate as notesdatetime
set sdate = new notesdatetime(Today)
set edate = new notsdatetime(sdate.dateonly)
call eddate.adjustday(14)
call sdate.setanytime
call edate.setanytime


dim comparedate as notesdatetime
dim inrange as boolean
dim doc as notesdocument
set doc = doccol.getfirstdocument
do until doc is nothing
inrange = false
forall dates in doc.getitemvalues("fieldname")
set comparedate = new notesdatetime(dates)
call comparedate.setanytime
if comparedate.timedifference(sdate)>=0 and edate.timedifference(comparedate)>=0 then
inrange = true
exit forall
End if

End Forall
if inrange then
doc.showinview = "Y"
call doc.save(true, true)
Elseif doc.showinview = "Y" then
doc.showinview = ""
call doc.save(true, true)
End If
set doc = doccol.getnextdocument(doc)
Loop

You'd have to do something similar for new or edited documents, maybe put something in the querysave of the form to check in the same way


Feedback response number WEBB8MDMRQ created by ~Hank Quetrepulnivu on 10/06/2011

Date comparision with Multivalued d... (~Joan Reki 6.Oct.11)
. . view (~Hank Quetrepul... 6.Oct.11)
. . . . i'd appreciate that help (~Elizabeth Nonf... 6.Oct.11)
. . . . . . agent (~Hank Quetrepul... 6.Oct.11)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS